<?php

class RM_Admin_EnhancedCalendarController extends RM_Controller {

    /**
     * update the Echnanced Calendar Config
     */
    function configupdateJsonAction() {
        $data = array(
            "show_list"=>$this->_getParam('show_list'),
            "show_details"=>$this->_getParam('show_details'),
            "show_day"=>$this->_getParam('show_day'),
            "show_week"=>$this->_getParam('show_week'),
            "show_twoweek"=>$this->_getParam('show_twoweek'),
            "show_month"=>$this->_getParam('show_month'),
            "read_only"=>$this->_getParam('read_only'),
            "showhelp_popup"=>$this->_getParam('showhelp_popup'),
            "close_onselect"=>$this->_getParam('close_onselect'),
            "fullday_starttime"=>$this->_getParam('fullday_starttime'),
            "fullday_endtime"=>$this->_getParam('fullday_endtime')
            );

        $model = new RM_EnhancedCalendarConfig();
        $model->update($data, "id=1");

        return array('data' => array('success' => true));
    }

    /**
     * Load the Enhamced calendar config
     */
    function configJsonAction() {
        $model = new RM_EnhancedCalendarConfig();
        $settings = $model->getSettings()->toArray();

        $json = new stdClass;
        $json->settings = $settings;

        return array(
            'data' => $json
        );
    }

}